#include<bits/stdc++.h>
using namespace std;

void work()
{
	int n; cin >> n;
	map<int, int> mp2; vector<vector<int>> nm;
	for (int i = 0; i < n; i++)
	{
		int b;
		cin >> b;
		vector<int> t;
		for (int j = 0; j < b; j++)
		{
			int tmp2;
			cin >> tmp2;
			t.push_back(tmp2);
			mp2[tmp2]++;
		}
		nm.push_back(t);
	}
	for (auto v : nm)
	{
		bool judge = true;
		for (int& k : v)
		{
			if (mp2[k] == 1)
			{
				judge = false;
				goto next;
			}
		}
		if (judge == true)
		{
			puts("YES");
			return;
		}
	next:;
	}
	puts("NO");


}

int main()
{
	int T2; cin >> T2;
	while (T2--) work();
	return 0;
}